<template>
  <div class="scr" v-show="show">
    <div class="alert">
      <p>{{text}}</p>
      <div class="buttom">
        <div @click="ok" class="ok">确定</div>
        <div @click="no" class="no">取消</div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      text: "确认不在收藏该歌单?",
      show: true
    };
  },
  mounted() {
    document.body.appendChild(this.$el);
  },
  methods: {
    async ok() {
      this.a_confirm && (await this.a_confirm());
      this.show = false;
    },
    no() {
      this.show = false;
      document.body.removeChild(this.$el);
      this.$destroy();
    }
  }
};
</script>
<style lang="less" scoped>
.scr {
  position: fixed;
  width: 100%;
  height: 100%;
  left: 0;
  top: 0;
  z-index: 2;
  .alert {
    width: 270px;
    height: 145px;
    position: fixed;
    top: -20%;
    bottom: 0;
    left: 0;
    right: 0;
    margin: auto;
    background-color: #fafafa;
    border-radius: 5px;
    border: 1px solid #ccc;
    box-shadow: 1px 0px 10px 0px grey;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    align-items: center;
    p {
      text-align: center;
      font-size: 16px;
      padding: 10px;
    }
    .buttom {
      display: flex;
      justify-content: center;
      align-items: center;
      text-align: center;
      div {
        outline: none;
        height: 30px;
        width: 80px;
        border-radius: 5px;
        display: flex;
        justify-content: center;
        align-items: center;
      }
      .ok {
        background-color: #0c73c2;
        color: white;
        &:hover {
          background-color: #1167a8;
        }
      }
      .no {
        background-color: #fff;
        border: 1px #e1e1e2 solid;
        margin-left: 15px;
        &:hover {
          background-color: #f5f5f7;
        }
      }
    }
  }
}
</style>